package objects;

import common.RealmConf;

public class Account
{
	private long _guid;
	private long _subscribeEnd;
	private byte _gmLevel;
	private String _pseudo,_question,_answer;
    private boolean _connected;
	
	public Account(long guid, long subsribeEnd, byte gmLevel, String pseudo, String question, String answer)
	{
		_guid = guid;
		_subscribeEnd = subsribeEnd;
		_gmLevel = gmLevel;
		_pseudo = pseudo;
		_question = question;
		_answer = answer;
	}

        public boolean setConnected(boolean Connected){
            if (Connected){
                _connected =true;
                return true;
               }
            else 
            {
            	_connected = false;
            	return false;
            }
        }
        
        public boolean getConnected() {
		if (_connected){
                return true;
                }
                else
                return false;
	}
        
	public long getGuid() {
		return _guid;
	}

	public boolean isSubscriber() {
		return _subscribeEnd>System.currentTimeMillis() || _gmLevel>=RealmConf._gmLevelAutoSubscribe || !RealmConf._activeSubscribe;
	}

	public byte getGmLevel() {
		return _gmLevel;
	}

	public String getPseudo() {
		return _pseudo;
	}

	public String getQuestion() {
		return _question;
	}

	public String getAnswer() {
		return _answer;
	}

	public long getSubscribeTimeEnd()
	{
		//If Auto Subscribe
		if(_gmLevel>=RealmConf._gmLevelAutoSubscribe || !RealmConf._activeSubscribe)return 31536000000l;// l (L) means "long value"
		return _subscribeEnd;
	}
	
}
